package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.CustomerTpTrain;
import org.springframework.beans.BeanUtils;

/**
 * 火车票政策
 * 企业客户的火车票差旅政策
 * TP - Travel Policy
 */
public class CustomerTpTrainDto extends BaseTpDto {

  /**
   * 火车类型
   * 高铁/动车/普通
   * 100： 高铁
   * 200： 动车
   * 300： 普通
   */
  private int trainType;

  /**
   * 高铁的座位等级
   * 50 商务座
   * 100 一等座
   * 200 二等座
   * TODO 其它车次的座位等级的待定
   */
  private int seatLevel;

  private String remark;

  public String getTrainTypeDesc() {
    switch (trainType) {
      case 100:
        return "高铁";
      case 200:
        return "动车";
      case 300:
        return "普通";
      default:
        return "未定义";
    }
  }

  public String getSeatLevelDesc() {
    switch (seatLevel) {
      case 50:
        return "商务座";
      case 100:
        return "一等座";
      case 200:
        return "二等座";
      default:
        return "未定义";
    }
  }

  public static CustomerTpTrainDto createdBy(CustomerTpTrain tpTrain) {
    CustomerTpTrainDto dto = new CustomerTpTrainDto();
    BeanUtils.copyProperties(tpTrain, dto);

    dto.setPositionId(tpTrain.getCustomerPosition().getPositionId());
    dto.setPositionName(tpTrain.getCustomerPosition().getName());
    dto.setPositionLevel(tpTrain.getCustomerPosition().getVipLevel());

//    dto.setTrainType(tpTrain);
//    dto.setVehicleGroupName(tpCar.getVehicleGroup().getName());

    return dto;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public int getTrainType() {
    return trainType;
  }

  public void setTrainType(int trainType) {
    this.trainType = trainType;
  }

  public int getSeatLevel() {
    return seatLevel;
  }

  public void setSeatLevel(int seatLevel) {
    this.seatLevel = seatLevel;
  }
}
